package collection;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

/**
 *
 */

public class ListDemo1 {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
//        List<String> list = new LinkedList<>();
        list.add("one");
        list.add("teo");
        list.add("three");
        list.add("four");
        list.add("five");
        System.out.println(list);


        String e = list.get(2);
        System.out.println(e);

        for (int i = 0; i < list.size(); i++) {
            System.out.print(list.get(i)+"\t");
        }
        System.out.println();

        String old = list.set(2,"six");
        System.out.print(list+"\t");
        System.out.println();
        System.out.println("被替换的元素是:"+old);

    }
}
